/* eslint valid-jsdoc: "off" */

'use strict';

/**
 * @param {Egg.EggAppInfo} appInfo app info
 */




module.exports = appInfo => {
  /**
   * built-in config
   * @type {Egg.EggAppConfig}
   **/
  const config = exports = {
    
  };

  // use for cookie sign key, should change to your own and keep security
  config.keys = appInfo.name + '_1633922181821_6761';

  // add your middleware config here
  config.middleware = ['corsMultiOrigin'];
  // config.middleware = [];

  // add your user config here
  const userConfig = {
    // myAppName: 'egg',
  };

  // mysql 配置
  config.mysql = {

    client:{
      host:'127.0.0.1',
      port:'3306',
      user:'root',
      password:'luul5829435',
      database:'hotpot_blog'
    },
    app:true,
    agent:false
  };

  // cors 配置
  config.security = {
    csrf:{
      enable:false
    },
    domainWhiteList:['*']
  };
  // config.cors = {
  //   // origin:'http://localhost:3000', // 设置为 * 时允许所有域名访问，但是因为客户端使用了 `withCredentials:true`，即带凭证的请求，所以这里(Access-Control-Allow-Origin)必须指定域名；
  //   origin:'http://localhost:3001',
  //   credentials:true,
  //   allowMethods:'GET,HEAD,PUT,POST,DELETE,PATCH,OPTIONS',

  // };

  // cors_multiOrigin
  config.corsMultiOrigin = {
    whiteList:['http://localhost:3000','http://localhost:3001'],
    credentials:true,
    allowMethods:'GET,HEAD,PUT,POST,DELETE,PATCH,OPTIONS',
  }

  return {
    ...config,
    ...userConfig,
  };
};
